package cn.jjaw.command.note.command;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ObjectMethodCommand extends MethodCommand{
    Object object;
    public ObjectMethodCommand(String[] s, Method method, Object obj) {
        super(s,method);
        this.object = obj;
    }

    @Override
    public Object execute(String[] command) {
        try {
            return invoke(command,object);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}
